package tests;

import common.Utils;
import org.bouncycastle.operator.bc.BcAESSymmetricKeyUnwrapper;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2025-04-28
 * Time: 11:27
 */
/*
所以没有登录界面的测试
 */
public class PageByNoLogin extends Utils {
    public static String url = "http://127.0.0.1:58080/index.html";
    public PageByNoLogin() {
        super(url);
    }
    // 判断是否为未登录状态
    public void ByNoLogin() throws InterruptedException {
        // 刷新页面
        driver.navigate().refresh();
        // 获取界面 url
        Thread.sleep(1000);
        String url1 = driver.getCurrentUrl();
        System.out.println(url1);
        // 断言判断是否为登录页面的 url
        WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(3));
        wait.until(ExpectedConditions.urlToBe("http://127.0.0.1:58080/sign-in.html"));
        assert url1.equals("http://127.0.0.1:58080/sign-in.html");
    }
}
